package service

import (
	"awesomeProject/app/model"
	"awesomeProject/app/request"
	"awesomeProject/app/response"
	"awesomeProject/global"
)

type StatisticsSrv struct{}

func (s StatisticsSrv) Analysis(req request.Statistics) response.Resp {
	// 商品统计
	var merchantStatistics model.MerchantStatistics
	err := global.Gorm.Where("`shop_id` = ?", req.ShopId).First(&merchantStatistics).Error
	if err != nil {
		return response.ErrQuery.SetMsg(err.Error())
	}

	return response.OK.WithData(merchantStatistics)
}
